import React, { Component, PropTypes } from 'react';
import { InputItem, Button, WingBlank, WhiteSpace, List, Flex, NavBar, Icon, Toast, Popup, Menu } from 'antd-mobile';
import { Link } from 'react-router';
import { getLocalTime } from '../utils/func';

export default class CheckoutDetail extends Component {
	constructor(props){
		super(props);
	}

	componentWillMount(){
		let { checkout_info, getCheckoutDetail } = this.props;
		let checkout_id = this.props.params.checkout_id;
		let key = 'info_' + checkout_id;
		if (typeof(checkout_info[key]) == 'undefined'){
			getCheckoutDetail(checkout_id);
		}
	}

	render() {
		let { checkout_info } = this.props;
		let checkout_id = this.props.params.checkout_id;
		let key = 'info_' + checkout_id;
		let checkinList = checkout_info[key];
		return (
				<div>
				    <NavBar leftContent={<Link to='/' style={{color:'#108ee9'}} className='nabbar_link'>返回</Link>} onLeftClick={(e) => {}} mode="light"
				    className='my_navbar_title'
				    >学生签到列表</NavBar>
				    <div className='my_container_blank'></div>
					<WhiteSpace size="sm" />

					<List>
					{
						typeof(checkinList) != 'undefined' 
						?
						checkinList.map(function(item){
							return <List.Item key={item.id} extra={getLocalTime(item.scan_time)}>{item.truename}[{item.nianji_name} {item.banji_name}]</List.Item>
						})
						:
						<div className='no_record'>没有记录</div>
					}
					</List>
				</div>
			);
	}
}